import Vue from 'vue'
import Vuex from 'vuex'
import {mockrequest} from "@/api"

Vue.use(Vuex)

const state={
    datas:[],
}

const actions={
    async getdata({commit}){
        let result = await mockrequest();
        if(result.code===200){
            commit('GETDATA',result.data)
        }
    },
}

const mutations={
    GETDATA(state,datas)
    {
        state.datas=datas;
    },
}

const getters={
}
export default new Vuex.Store({
    state,
    mutations,
    actions,
    getters,
})